<template>
  <div>
    <h1>确实挺不错的</h1>
    <button @click="dd">全局事件总线发射</button>
    <button @click="normal">常规兄弟传值发射</button>
    <button @click="pubsub">消息发布发射</button>
  </div>
</template>

<script>
import pubsub from "pubsub-js";

export default {
  mounted() {
    console.log("anothoer mounted组件进来了");
  },
  created() {
    console.log("another create组件进来了");
  },
  name: "anthoer",
  data() {
    return {
      hobby: ["游泳", "下棋", "篮球"],
    };
  },
  methods: {
    pubsub() {
      pubsub.publish('hello',666)
    },
    dd() {
      console.log("anthoer.vue进来了");
      this.$bus.$emit("ss", this.hobby);
    },

    normal() {
      console.log("normal方法进来了");
      this.$emit("gc", this.hobby);
    },
  },
};
</script>

<style>
</style>